package LeetCode;

import java.util.Arrays;

/**
 * @author 豆包LU
 * @date 2023/4/11 14:01
 */
public class Main {

    /**
     * Desc:存在重复元素
     * @author 豆包LU
     * @date 2023/4/11 14:02
     */
    /* public static void main(String[] args) {
        ContainsDuplicate containsDuplicate = new ContainsDuplicate();
        int[] nums1 = {1, 2, 3, 1};
        boolean result1 = containsDuplicate.containsDuplicate(nums1);
        System.out.println("输入: nums1 = [1, 2, 3, 1]");
        System.out.println("输出: " + result1); // 预期输出: true

        int[] nums2 = {1, 2, 3, 4};
        boolean result2 = containsDuplicate.containsDuplicate(nums2);
        System.out.println("输入: nums2 = [1, 2, 3, 4]");
        System.out.println("输出: " + result2); // 预期输出: false

        int[] nums3 = {1, 1, 1, 3, 3, 4, 3, 2, 4, 2};
        boolean result3 = containsDuplicate.containsDuplicate(nums3);
        System.out.println("输入: nums3 = [1, 1, 1, 3, 3, 4, 3, 2, 4, 2]");
        System.out.println("输出: " + result3); // 预期输出: true
    }*/

    /**
     * Desc:53. 最大子数组和
     * @author 豆包LU
     * @date 2023/4/11 14:02
     */
    /*
    public static void main(String[] args) {
        MaxSubArray solution = new MaxSubArray();
        int[] nums1 = {-2, 1, -3, 4, -1, 2, 1, -5, 4};
        int result1 = solution.maxSubArray(nums1);
        System.out.println("输入: nums1 = [-2, 1, -3, 4, -1, 2, 1, -5, 4]");
        System.out.println("输出: " + result1);
        // 预期输出: 6

    }
*/

    /**
     * Desc:704. 二分查找
     * @author 豆包LU
     * @date 2023/4/11 14:02
     */
    /*
    public static void main(String[] args) {
        BinarySearch solution = new BinarySearch();

        int[] nums = {-1, 0, 3, 5, 9, 12};
        int target1 = 9;
        int target2 = 2;

        int result1 = solution.search(nums, target1);
        int result2 = solution.search(nums, target2);

        System.out.println("数组 nums: " + Arrays.toString(nums));
        System.out.println("目标值 target1: " + target1 + "，下标为: " + result1);
        System.out.println("目标值 target2: " + target2 + "，下标为: " + result2);
    }
*/


    /* public static void main(String[] args) {
        SearchInsertPosition solution = new SearchInsertPosition();
        int[] nums = {1, 3, 5, 6};
        int target1 = 5;
        int target2 = 2;
        int target3 = 7;

        int index1 = solution.searchInsert(nums, target1);
        System.out.println("Target " + target1 + " should be inserted at index: " + index1);

        int index2 = solution.searchInsert(nums, target2);
        System.out.println("Target " + target2 + " should be inserted at index: " + index2);

        int index3 = solution.searchInsert(nums, target3);
        System.out.println("Target " + target3 + " should be inserted at index: " + index3);
    }*/

     /**
     * 剑指 Offer 09
     * Desc:704. 二分查找
     * @author 豆包LU
     * @date 2023/4/11 14:02
     */
     /* public static void main(String[] args) {
        Offer09 obj = new Offer09();
        obj.appendTail(3);
        System.out.println(obj.deleteHead());
        // 输出 3
        System.out.println(obj.deleteHead());
        // 输出 -1
        obj.appendTail(5);
        obj.appendTail(2);
        System.out.println(obj.deleteHead());
        // 输出 5
        System.out.println(obj.deleteHead());
        // 输出 2
    }*/

     public static void main(String[] args) {
         int[] nums1 = { 0, 5,2,2};

         Offer03 solution = new Offer03();
         int result1 = solution.findRepeatNumber(nums1);

         System.out.println("数组 nums1 中的重复数字为：" + result1);
     }
}

